package com.tomcov.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.maps.client.MapOptions;
import com.google.gwt.maps.client.MapTypeId;
import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.base.LatLng;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.SuggestBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

public class MapViewImpl extends Composite implements MapView  {

	@SuppressWarnings("unused")
	private Presenter presenter;
	private static final MyUiBinder binder = GWT.create(MyUiBinder.class);
	interface MyUiBinder extends UiBinder<AbsolutePanel, MapViewImpl> {
	}
	
	@UiField(provided = true)
	MapWidget mapWidget;
	
	@UiField SuggestBox FromAdress,ToAdress;
	@UiField VerticalPanel directionPanel;
	@UiField TextBox DetourBox;
	@UiField Button RoadButton,AddJourneyButton;
	@UiField VerticalPanel possibleUser;
	@UiField Label Map,MessageOut,MessageIn,Myjourney,Logout,Settings;
	
	public MapViewImpl(){
		MapOptions options = new MapOptions();
		options.setCenter(new LatLng(50.6687, 4.57967));
		options.setZoom(12);
		options.setMapTypeId(new MapTypeId().getRoadmap());
		options.setNavigationControl(true);
		options.setDraggable(true);
		options.setMapTypeControl(true);
		options.setScrollwheel(true);
		mapWidget = new MapWidget(options);
		mapWidget.setPixelSize(450,450);
		
		initWidget(binder.createAndBindUi(this));
		
	}
	
	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter=presenter;
		
	}
	
	public VerticalPanel getPossibleUserPanel(){
		return possibleUser;
	}

	@Override
	public RadioButton getDriverRadioButton() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Label getDateOfJourney() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public SuggestBox getFromAddress() {
		return FromAdress;
	}

	@Override
	public SuggestBox getToAddress() {
		return ToAdress;
	}

	@Override
	public int getDetour() {
	
		return Integer.parseInt(DetourBox.getText());
	}

	@Override
	public Button getAddJourneyButton() {
		return AddJourneyButton;
	}

	@Override
	public HasClickHandlers getRoadButton() {
		return RoadButton;
	}

	@Override
	public MapWidget getMap() {
		return mapWidget;
	}

	@Override
	public VerticalPanel getDirectionsPanel() {
		return directionPanel;
	}

	@Override
	public Label getMapLabel() {
		return Map;
	}

	@Override
	public Label getLogoutLabel() {
		return Logout;
	}

	@Override
	public Label getMessageOutLabel() {
		return MessageOut;
	}
	@Override
	public Label getMessageInLabel() {
		return MessageIn;
	}

	@Override
	public Label getSettingsLabel() {
		return Settings;
	}

	@Override
	public Label getMyjourneyLabel() {
		return Myjourney;
	}
	
	

}
